%Dim ID,Rs,Page_Url
If Not MNBoard.Founduser Then MNBoard.GoToErr(10)
If Request.QueryString("page") > 1 Then
Page_Url = "?Page="&Request.QueryString("page")
Else
Page_Url = ""
End If
MNBoard.Head"Faction.asp"&Page_Url,"","论坛派对"
ID = MNBoard.CheckNum(Request.querystring("ID"))
Select Case Left(Request("Action"),10)
Case"Add"
Add
Case"Edit"
Edit
Case"FactionAdd"
FactionAdd
Case"FactionOut"
FactionOut
Case"Look"
Look
Case"Del"
Del
Case Else
Main()
End Select
MNBoard.Footer
Set MNBoard =Nothing
Sub Main()
Dim intPageNow,strPageInfo,arr_Rs,i,Pages,page,Content
Content="
创建派对 退出派对 |
"&_
"派别 | 宗旨 | 创始人 | 动作 | 帮主管理 |
"
intPageNow = Request.QueryString("page")
Set Pages = New Cls_PageView
Pages.strTableName = "[i_Faction]"
Pages.strFieldsList = "ID,Name,Note,User,BuildDate"
Pages.strOrderList = "ID desc"
Pages.strPrimaryKey = "ID"
Pages.intPageSize = 15
Pages.intPageNow = intPageNow
Pages.strCookiesName = "Faction"'客户端记录总数
Pages.Reloadtime=3'每三分钟更新Cookies
Pages.strPageVar = "page"
Pages.InitClass
Arr_Rs = Pages.arrRecordInfo
strPageInfo = Pages.strPageInfo
Set Pages = nothing
If IsArray(Arr_Rs) Then
For i = 0 to UBound(Arr_Rs, 2)
Content=Content & ""&Arr_Rs(1,i)&" | "&Arr_Rs(2,i)&" | "&Arr_Rs(3,i)&" | "
If SESSION(CacheName & "MyInfo")(25)=Arr_Rs(1,i) then
Content=Content & "退出此帮"
Else
Content=Content & "加入此帮"
End if
Content=Content & " | 修改 解散 |
"
Next
End If
Content=Content & "
"&strPageInfo&"
"
MNBoard.ShowTable"论坛派对",Content
End Sub
Sub FactionAdd
Dim Content,Rs
MNBoard.CheckMake
If SESSION(CacheName & "MyInfo")(25)<>"" Then
MNBoard.Alert"您已经加入["&SESSION(CacheName & "MyInfo")(25)&"]了!请先退出["&SESSION(CacheName & "MyInfo")(25)&"]才能加入新帮","?"
ElseIf Int(SESSION(CacheName & "MyInfo")(6))<3 then
MNBoard.Alert"您的"&MNBoard.Info(121)&"值小于3!没有资格加入派对!","?"
Else
Set Rs=MNBoard.Execute("select Name from [i_Faction] where ID="&ID)
IF Not Rs.Eof Then
MNBoard.Execute("update [i_user] Set Faction='"&rs(0)&"' where Name='"&MNBoard.MyName&"'")
Session(CacheName & "MyInfo") = Empty
MNBoard.Alert"成功的加入 ["&Rs(0)&"] 派对!","?"
Else
MNBoard.Alert"不存在这个派对!","?"
End If
Rs.Close
End If
End Sub
Sub FactionOut
MNBoard.CheckMake
If SESSION(CacheName & "MyInfo")(25)="" Then
MNBoard.Alert"您目前还没有加入任何派对!","?"
Else
If Not MNBoard.Execute("select ID from [i_Faction] where user='"&MNBoard.MyName&"'").eof Then
MNBoard.Alert"您是掌门人,不能退出派对!退出必需先要解散派对!","?"
Else
MNBoard.execute("Update [i_user] Set Faction='',Mark=Mark-1 where name='"&MNBoard.MyName&"'")
Session(CacheName & "MyInfo") = Empty
End If
MNBoard.Alert"退出派对成功","?"
End If
End Sub
Sub Del
MNBoard.CheckMake
Set Rs=MNBoard.Execute("Select Name,User From[i_Faction] where ID="&ID)
If Rs.Eof Then
MNBoard.Alert"不存在这个派对!","?"
ElseIf MNBoard.MyName<>Rs(1) Then
MNBoard.Alert"您不是该帮的帮主无法解散该帮!","?"
Else
MNBoard.Execute("Update [i_user] set Faction='' where Faction='"&rs(0)&"'")
MNBoard.Execute("Delete from [i_Faction] where ID="&ID)
Session(CacheName & "MyInfo") = Empty
MNBoard.Alert"解散派对成功!","?"
End if
Rs.Close
End Sub
Sub Look
Dim Content
Set Rs=MNBoard.Execute("Select Name,FullName,Note,User,BuildDate from [i_Faction] where ID="&ID)
If Rs.eof Then
MNBoard.Alert"不存在此派对!","?"
Else
Content="派对名称: | "&MNBoard.Fun.HtmlCode(rs(0))&" |
"&_
"派对全称: | "&MNBoard.Fun.HtmlCode(rs(1))&" |
"&_
"派对宗旨: | "&MNBoard.Fun.HtmlCode(rs(2))&" |
"&_
"创建时间: | "&Rs(4)&" |
"&_
"帮主名称: | "&Rs(3)&" |
"&_
"现有弟子: | "&Desciple(Rs(0))&" |
"&_
"【返回】 |
"
MNBoard.ShowTable"派对信息",Content
End If
Rs.Close
End Sub
Function Desciple(name)
Dim dRs,I
I=0
Set dRs=MNBoard.Execute("Select Name From [i_user] where Faction='"&Name&"'")
Do while not dRs.eof
I=I+1
Desciple=Desciple & ""&dRs(0)&" "
dRs.movenext
Loop
dRs.close:Set dRs=NoThing
Desciple=""
End Function
Sub Add
Dim Name,FullName,Note,Content
MNBoard.CheckMake
Name=MNBoard.Fun.GetStr("Name")
FullName=MNBoard.Fun.GetStr("FullName")
Note=MNBoard.Fun.GetStr("Note")
IF Name="" And FullName="" And Note="" Then
Content=""
MNBoard.ShowTable"创建派对",Content
Else
IF Name="" or FullName="" or Note="" Then
MNBoard.Alert"派对要填写的信息你没有填写完整。","?"
ElseIF Len(Name)>6 or Len(FullName)>50 Or Len(Note)>200 Then
MNBoard.Alert"字符太多,超过了论坛的限制。","?"
ElseIf int(SESSION(CacheName & "MyInfo")(6))<20 then
MNBoard.Alert"您的"&MNBoard.Info(121)&"小于 20 !","?"
ElseIf int(SESSION(CacheName & "MyInfo")(7))<10000 then
MNBoard.Alert"您的"&MNBoard.Info(120)&"少于 10000 !","?"
ElseIf Not MNBoard.Execute("Select ID From[i_Faction] where User='"&MNBoard.MyName&"'").Eof Then
MNBoard.Alert"您已经贵为帮主了,不能再创立派对!","?"
Else
MNBoard.execute("Insert into[i_Faction](Name,FullName,[Note],BuildDate,[User])Values('"&Name&"','"&FullName&"','"&Note&"','"&MNBoard.NowBbsTime&"','"&MNBoard.MyName&"')")
MNBoard.execute("Update [i_User] Set Coin=Coin-10000,Faction='"&Name&"' where ID="&MNBoard.MyID&"")
Session(CacheName & "MyInfo") = Empty
MNBoard.Alert"您成功的创建了派对["&Name&"],您现在是该派对的掌门人!恭喜您!","?"
End if
End if
End Sub
Sub Edit
Dim Name,FullName,Note,Content
Name=MNBoard.Fun.GetStr("Name")
FullName=MNBoard.Fun.GetStr("FullName")
Note=MNBoard.Fun.GetStr("Note")
Set Rs=MNBoard.Execute("Select Name,FullName,Note,User from [i_Faction] where ID="&ID)
If Rs.eof Then
MNBoard.Alert"不存在此派对!","?"
ElseIf MNBoard.MyName<>Rs(3) Then
MNBoard.Alert"您不是["&Rs(0)&"]的帮主无法修改信息!","?"
Else
IF Name="" And FullName="" And Note="" Then
Set Rs=MNBoard.Execute("Select Name,FullName,Note,User from [i_Faction] where ID="&ID)
If Rs.eof Then
MNBoard.Alert"不存在此派对!","?"
ElseIf MNBoard.MyName<>Rs(3) Then
MNBoard.Alert"您不是["&Rs(0)&"]的帮主无法修改信息!","?"
Else
Content=""
MNBoard.ShowTable"创建派对",Content
End If
Else
IF Name="" or FullName="" or Note="" Then
MNBoard.Alert"派对要填写的信息你没有填写完整。","?"
ElseIf int(SESSION(CacheName & "MyInfo")(7))<1000 then
MNBoard.Alert"对不起,你的"&MNBoard.Info(120)&"少于1000元,不能整顿派对。","?"
ElseIF Len(Name)>10 or Len(FullName)>50 Or Len(Note)>200 Then
MNBoard.Alert"字符太多,超过了论坛的限制。","?"
Else
MNBoard.execute("Update [i_User] Set Faction='"&Name&"' where Faction='"&Rs(0)&"'")
MNBoard.execute("Update [i_User] Set Coin=Coin-1000 where Name='"&MNBoard.MyName&"'")
MNBoard.execute("Update [i_Faction]Set Name='"&Name&"',FullName='"&FullName&"',[Note]='"&Note&"' where ID="&ID)
Session(CacheName & "MyInfo") = Empty
MNBoard.Alert"成功的修改了派对!","?"
End if
End if
End If
Rs.Close
End Sub
%>